<template>
  <div id='DetailBaseInfo' class='DetailBaseInfo'>
    <div class="info-title">{{goods.title}}</div>
    <div class="info-price">
      <span class="n-price">{{goods.newPrice}}</span>
      <span class="o-price">{{goods.oldPrice}}</span>
      <span v-if="goods.discount" class="discount">{{goods.discount}}</span>
    </div>
    <div v-if="goods.columns" class="info-other">
      <span>{{goods.columns[0]}}</span>
      <span class="t-center">{{goods.columns[1]}}</span>
      <span class="t-right">{{goods.services[goods.services.length-1].name}}</span>
    </div>

    <div v-if="goods.services" class="info-services">
      <span class="info-services-item" v-for="index in goods.services.length-1" :key="index">
        <img v-if="goods.services[index-1].icon" :src="goods.services[index-1].icon" alt="">
        <span>{{goods.services[index-1].name}}</span>
      </span>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'DetailBaseInfo',
    props: { // 父辈向子辈传参
      goods: {
        type: Object,
        default () {
          return {}
        }
      }
    },
    components: { // 组件的引用

    },
    data() {
      return {

      }
    },
    methods: { // 方法

    },
    computed: { // 计算属性

    },
    created() { // 实例被创建之后执行代码

    },
    mounted() { // 页面进入时加载内容

    },
    watch: { // 监测变化

    }
  }

</script>
<style scoped>
  .DetailBaseInfo {
    margin-top: 15px;
    padding: 0 10px;
  }

  .info-title {
    font-size: 18px;
    color: #494c4e;
    font-weight: bold;
  }

  .info-price {
    margin-top: 10px;
  }

  .n-price {
    font-size: 25px;

    color: var(--color-high-text);
  }

  .o-price {
    margin: 0 5px;
    font-size: 15px;
    text-decoration: line-through;
    color: #999;
  }

  .discount {
    display: inline-block;
    height: 20px;
    color: white;
    border-radius: 10px;
    font-size: 15px;
    padding: 0 6px;
    text-align: center;
    line-height: 20px;
    background-color: var(--color-high-text);
  }

  .info-other {
    margin-top: 20px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    padding-bottom: 10px;
    color: #999;
    font-size: 15px;
  }

  .info-other span {
    flex: 1;
  }

  .t-center {
    text-align: center;
  }

  .t-right {
    text-align: right;
  }

  .info-services {
    display: flex;
    height: 80px;
    line-height: 80px;
    border-bottom: 6px solid #eee;
    font-size: 15px;
  }

  .info-services-item {
    flex: 1;
    color: #3d4149;
    white-space: nowrap;
  }

  .info-services-item img {
    width: 15px;
    height: 15px;
    position: relative;
    top: 2px;
  }

</style>
